//定义用户列表的约束
const mongoose = require("mongoose");
const md5 = require("../util/md5");
const userModel = new mongoose.Schema({
  username: {
    type: String,
    require: true,
  },
  password: {
    type: String,
    require: true,
    set: (val) => md5(val),
    select:false //设置了select 当查询数据时候不会再将password返回
  },
  email: {
    type: String,
    require: true,
  },
  phone: {
    type: String,
    require: true,
  },
});
module.exports = userModel;
